#ifndef HTTPRESPONSE_H
#define HTTPRESPONSE_H
#include <Buffer.h>
#include <stdio.h>
enum HttpStatusCode {
    UnKnown,
    OK =200,
    MovedPermanently = 301,
    MovedTemporarily = 302,
    BadRequest = 400,
    NotFound = 404
};

struct ResponseHeader {
    char key[32];
    char value[128];
};

typedef void (*responseBody)(const char* fileName, struct Buffer* sendBuf, int socket);

struct HttpResponse {
    enum HttpStatusCode statusCode;
    char statusMsg[128];
    char fileName[128];

    struct ResponseHeader* headers;
    int headerNum;

    responseBody sendDataFunc;
};

struct HttpResponse* httpResponseInit();


void httpResponseAddHeader(struct HttpResponse* response, const char* key, const char* value);

void httpResponsePrepareMsg(struct HttpResponse* response, struct Buffer* sendBuf, int socket);



#endif // HTTPRESPONSE_H
